<form action="<?php echo $form['action']; ?>" method="post">
    <fieldset>
        <legend><?php echo $form['title']; ?></legend>

        <?php if (isset($form['error'])): ?>
        <div class="error"><strong>Error:</strong> <?php echo $form['error']; ?></div>
        <?php endif; ?>

        <?php foreach ($form['data'] as $key => $val): ?>
        <label>
            <?php echo $key; ?>
            <input class="text-input" name="<?php echo $key ?>" value="<?php echo htmlspecialchars($val); ?>" />
        </label>
        <?php endforeach; ?>
    </fieldset>
    <input type="submit" value="Submit" />
</form>
